IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'sp_Report_ProductList')
	DROP PROCEDURE dbo.sp_Report_ProductList
GO
CREATE PROCEDURE dbo.sp_Report_ProductList
	@LotID INT
AS
BEGIN
	SET NOCOUNT ON
	SET FMTONLY OFF
	SET NO_BROWSETABLE OFF

	DECLARE @_LotID INT
	SET @_LotID = @LotID

	SELECT
		l.LotCode
		, l.Date
		, p.Barcode
		, p.ProductCode
		, p.Manufacture
		, p.ManufacturedDate
		, p.PressureTest
		, p.PressureLoad
		, p.Volume
		, p.Weight
		, p.Description
		, c.CategoryName
	FROM
		dbo.Lots l
		JOIN dbo.Products p ON p.LotID = l.LotID
		JOIN dbo.Categories c ON c.CategoryID = p.CategoryID
	WHERE
		l.LotID = @_LotID
END
GO